package Thread.Safe;

public class synchronize_common {
    public static void main(String[] args) {
        Counter counter1=new Counter();
        Thread t1=new Thread(()->{
            counter1.increase();
        });
        t1.start();
        Counter counter2=new Counter();
        Thread t2=new Thread(()->{
            counter2.increase();
        });
        t2.start();
    }
    private static class Counter {
        int val;
        int val2;
         synchronized  void increase(){
             val++;
         }

         synchronized  void increase1(){
             val2++;
             increase();
         }
    }

}
